c# array last element

75

c# array last element -

int[] array = { 1, 3, 5 };
var lastItem = array[^1]; // 5

c# get last array element -

string[] items = GetAllItems();
string lastItem = items[items.Length - 1];
int arrayLength = array.Length;

Comments

Submit
0 Comments